import { createRouter, createWebHistory } from 'vue-router'
import home from '../views/Home/index.vue'
import library from '../views/Library/index.vue'
import libraryScheme from '../views/Library/Scheme/index.vue'
import librarySchemeAudit from '../views/Library/Audit/index.vue'
import toAudit from '../views/ToAudit/index.vue'
import createToAuditById from '../views/ToAudit/Audit/index.vue'
import auditResult from '../views/ToAudit/Result/index.vue'
import createSchemeById from '../views/Library/Scheme/detail.vue'
import homeBuild from '../views/Build/index.vue'
import createGenerateById from '../views/Generate/index.vue'
import log from '../views/Log/index.vue'
import createGenerateResultById from '../views/Result/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      redirect: '/home',
      children: [
        {
          path: 'home',
          name: 'default',
          component: home,
        },
      ],
    },
    {
      path: '/homeBuild',
      name: 'homeBuild',
      component: homeBuild,
    },
    {
      path: '/create',
      name: 'create',
      component: library,
      redirect: '/create/libraryScheme',
      children: [
        {
          // 方案生成
          path: 'libraryScheme',
          name: 'libraryScheme',
          component: libraryScheme,
        },
        {
          // 方案审核
          path: 'librarySchemeAudit',
          name: 'librarySchemeAudit',
          component: librarySchemeAudit,
        },
      ],
    },
    {
      path: '/log',
      name: 'log',
      component: log,
    },
    {
      path: '/createToAudit',
      name: 'createToAudit',
      component: toAudit,
    },
    {
      path: '/createToAudit/:id',
      name: 'createToAuditById',
      component: createToAuditById,
    },
    {
      path: '/createAuditPass/:id/:pass',
      name: 'createAuditPassById',
      component: auditResult,
    },
    {
      path: '/createScheme/:id',
      name: 'createSchemeById',
      component: createSchemeById,
    },
    {
      path: '/createGenerate/:type',
      name: 'createGenerateById',
      component: createGenerateById,
    },
    {
      path: '/createGenerateResult/:id',
      name: 'createGenerateResultById',
      component: createGenerateResultById,
    },
  ],
})

export default router
